package com.coderman.datacsdn.service;


import com.coderman.daoclient.bean.KVPair;
import com.coderman.daoclient.dao.IDao;
import com.coderman.daoclient.dao.impl.IDaoImpl;
import com.coderman.datacsdn.model.entity.BlogExt;
import com.coderman.datacsdn.model.entity.CsdnBlog;
import com.coderman.datacsdn.model.entity.CsdnUserEntity;
import org.apache.commons.io.FileUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;

/**
 * Created by 58-daojia on 2017-12-22.
 *
 * @author: fanchunshuai
 * @version: V1.0
 * @Desc:  将爬取到的csdn-blog-html存入mysql数据库
 * @Copyright (c) 2017 58到家-版权所有
 */
public class ReadBlogToDB {


    public static void main(String[] args) {

        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5,8,1000, TimeUnit.MINUTES,
                new ArrayBlockingQueue<Runnable>(10));
        ExeInsertDB exeInsertDB = new ExeInsertDB(950,1000,"exeInsertDB");
        ExeInsertDB exeInsertDB2 = new ExeInsertDB(1000,1050,"exeInsertDB2");
        //ExeInsertDB exeInsertDB3 = new ExeInsertDB(850,900,"exeInsertDB3");
        //ExeInsertDB exeInsertDB4 = new ExeInsertDB(900,950,"exeInsertDB4");
        //ExeInsertDB exeInsertDB5 = new ExeInsertDB(750,800,"exeInsertDB5");
        threadPoolExecutor.execute(exeInsertDB);
        threadPoolExecutor.execute(exeInsertDB2);
        //threadPoolExecutor.execute(exeInsertDB3);
        //threadPoolExecutor.execute(exeInsertDB4);
        //threadPoolExecutor.execute(exeInsertDB5);
        try {
            threadPoolExecutor.awaitTermination(150,TimeUnit.MINUTES);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        threadPoolExecutor.shutdown();
    }


}
